<?php

/**
 * CacheRaidHistory filter form base class.
 *
 * @package    raidpoints
 * @subpackage filter
 * @author     David Driscoll
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseCacheRaidHistoryFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'raidid'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Raid'), 'add_empty' => true)),
      'scheduled_date' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'expiry'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cache'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'raidid'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Raid'), 'column' => 'id')),
      'scheduled_date' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'expiry'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cache'          => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('cache_raid_history_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CacheRaidHistory';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'raidid'         => 'ForeignKey',
      'scheduled_date' => 'Date',
      'expiry'         => 'Number',
      'cache'          => 'Text',
    );
  }
}
